-
Notifications
You must be signed in to change notification settings - Fork 179
chore: hide scrollbars in dev pages when motion is disabled on Safari #3303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit f9aeff8.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3303 +/- ##
========================================
Coverage 96.42% 96.42%
========================================
Files 791 791
Lines 22610 22610
Branches 7396 7806 +410
========================================
Hits 21802 21802
+ Misses 801 754 -47
- Partials 7 54 +47 ☔ View full report in Codecov by Sentry. |
@@ -20,6 +20,15 @@ body { | |||
caret-color: transparent !important; | |||
} | |||
// stylelint-enable @cloudscape-design/no-implicit-descendant, selector-max-type | |||
|
|||
html:has(&.safari) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions:
- Where
&
points to?<html>
or<body>
tag? - Would it be possible to set
::-webkit-scrollbar
onbody
rather thanhtml
so it would make the selector simpler?
body.safari::-webkit-scrollbar {
inline-size: 0;
block-size: 0;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&
expands to the parent selector. So in this case the selector becomeshtml:has(:global(.awsui-motion-disabled).safari)
- This is on purpose, because there are scrollbars at the page level, and we want to hide them too. Just double-checked on Safari that targeting the
html
element instead ofbody
is needed for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I think we can add this conversation as a comment on top of the selector. Just to have a bit more context around it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, added a comment
Description
When updating Safari from 15 to 16 in our visual regression Safari tests, scrollbars appear and they happen to be flaky —with variable opacity, and sometimes not appearing at all, causing unexpected screenshot diffs. Therefore bringing back scrollbars hiding for Safari in our dev pages.
After this change, scrollbars are not visible when using Safari and motion is disabled.
Note: I noticed that for the setting to have effect, motion needs to be disabled when the page is loaded. So in order to switch scrollbars on or off manually, it is necessary not only to toggle the motion disabled option (either via the checkbox or via the URL parameters) but also to reload the page. This seems to be a browser limitation and does not affect our tests.
This reverts commit f9aeff8 "in essence", but with two differences:
Other options considered:
How has this been tested?
Ran in my pipeline. Scrollbars are consistently hidden in Safari components tests.
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.